﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT" />
    <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1" />
    <title>登录</title>
    <script type="text/javascript" src="~/lib/jquery/jquery-1.9.0.min.js"></script>
    <script type="text/javascript" src="~/lib/ligerUI/js/ligerui.all.js"></script>
    <script type="text/javascript" src="~/Scripts/common.js"></script>
    <link rel="stylesheet" href="/Content/css/login.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="/Scripts/Png.js"></script>
    <script type="text/javascript">
    EvPNG.fix('div, ul, img, li, input, a');
    </script>
    <![endif]-->
</head>
<body scroll="no">
    <div class="container">
        <div class="divlogfrm">
            <div class="divloginlogo">
                <div class="logodiv"><img src="/Content/images/login/loginfrm_log.png" width="91" height="91" alt="福建省泉州市第一医院" /></div>
                <div class="logotit">福建省泉州市第一医院</div>
            </div>
            <div class="divloginfo">
                <div class="login-tit">护理信息系统</div>
                <div class="login-uname-tit">用户名</div>
                <div class="login-uname-input"><input type="text" value="" id="txtName" maxlength="20" onkeypress="EnterPress(event)" class="login-input" /></div>
                <div class="login-pwd-tit">密码</div>
                <div class="login-uname-input"><input type="password" value="" id="txtPwd" maxlength="20" onkeypress="EnterPress(event)" class="login-input" /></div>
                <div class="login-btndiv">
                    <input type="image" src="~/Content/images/login/btn2.png" class="btn-res" id="reset" />
                    <input type="image" src="~/Content/images/login/btn1.png" class="btn-login" id="login" />
                </div>
                <div class="message" id="errmsg"></div>
            </div>
        </div>
        <div class="copydiv">Copyright&copy;厦门识凌科技有限公司</div>
    </div>
    <script type="text/javascript">
        function ClickRemoveChangeCode() {
            var code = $("#imgCode").attr("src");
            $("#imgCode").attr("src", code + "1");
        }
        function EnterPress(e) {
            var e = e || window.event;
            if (e.keyCode == 13) {
                $('#login').click();
            }
        }
        $("#login").click(function () {
            var userName = $("#txtName").val();
            var userPassword = $("#txtPwd").val();
            var yzm = $("#txtyzm").val();
            if (IsEmpty(userName)) {
                $("#errmsg").text("用户名不能为空");
                $("#txtName").focus();
                return;
            }
            if (IsEmpty(userPassword)) {
                $("#errmsg").text("密码不能为空");
                $("#txtPwd").focus();
                return;
            }
            //if (IsEmpty(yzm)) {
            //    $("#errmsg").text("验证码不能为空");
            //    $("#txtyzm").focus();
            //    return;
            //}
            var postData = {
                userName: userName,
                userPassword: userPassword,
                yzm: yzm
            };
            $.ajax({
                url: "/Login/DoAction",
                type: "GET",
                cache: false,
                async: true,
                data: postData,
                success: function (data) {
                    var result = $.parseJSON(data);
                    if (result.Result == 1) {
                        $("#errmsg").text("登录成功，请稍候...");
                        window.location.href = "/Home/Index";
                    }
                    else if (result.Result == 0) {
                        $("#errmsg").text(result.Body);
                        ClickRemoveChangeCode();
                    }
                    else {
                        $("#errmsg").text("程序错误");
                        ClickRemoveChangeCode();
                    }
                },
                error: function () {
                    $("#errmsg").text("程序错误");
                    ClickRemoveChangeCode();
                }
            });
        });
        $("#reset").click(function () {
            $("#txtName").val("");
            $("#txtPwd").val("");
            $("#txtyzm").val("");
            $("#errmsg").text("");
        });
    </script>
</body>
</html>